<?php
$bootstrap = require_once('bootstrap-local.php');
$THIS_SERVER_BASE_URL = $bootstrap['this_server_base_uri'];
if (Yii::$app instanceof \yii\web\Application){
    $THIS_SERVER_BASE_URL = $_SERVER['HTTP_HOST'];
}
define("THIS_SERVER_BASE_URI", $THIS_SERVER_BASE_URL);

define("YII_BT_TIME", time());
define("YII_BT_DATE", date("Y-m-d", YII_BT_TIME));
define("YII_BT_DATETIME", date("Y-m-d H:i:s", YII_BT_TIME));
define("YII_BT_MTIME", microtime(true));
define("YII_PROJECT_ROOT", dirname(dirname(__DIR__))); // 根目录

Yii::setAlias('@wroot', YII_PROJECT_ROOT. '/web');
Yii::setAlias('@wurl', THIS_SERVER_BASE_URI);
Yii::setAlias('@staticRoot', YII_PROJECT_ROOT. '/web/static');
Yii::setAlias('@staticUrl', THIS_SERVER_BASE_URI . '/static');
Yii::setAlias('@common', YII_PROJECT_ROOT. '/common');
Yii::setAlias('@frontend', YII_PROJECT_ROOT. '/frontend');
Yii::setAlias('@api', YII_PROJECT_ROOT. '/api');
Yii::setAlias('@backend', YII_PROJECT_ROOT . '/backend');
Yii::setAlias('@smalldmin', YII_PROJECT_ROOT . '/smalldmin');
Yii::setAlias('@fztadmin', YII_PROJECT_ROOT . '/fztadmin');
Yii::setAlias('@console', YII_PROJECT_ROOT . '/console');

if (!function_exists('dd')) {
    function dd(...$args)
    {
        if (function_exists('dump')) {
            dump(...$args);
        } else {
            var_dump(...$args);
        }
        die;
    }
}

Yii::$container->set(\yii\widgets\LinkPager::class, [
    'maxButtonCount' => 10,
    'firstPageLabel' => '首页',
    'lastPageLabel' => '末页',
    'prevPageLabel'=>'上一页',
    'nextPageLabel'=>'下一页',
]);

Yii::$container->set(\yii\data\Pagination::class, [
    'defaultPageSize' => 20,
]);